﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Markup;

namespace SmartRoomFinder.Helpers
{

    public class BooleanToFormatStringConverter:MarkupExtension,IValueConverter
    {
        private BooleanToFormatStringConverter converter;
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            return converter ?? (converter = new BooleanToFormatStringConverter());
        }

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return Binding.DoNothing;
            }
            return bool.Parse(value.ToString()) ? "ddd, dd MMM yyyy" : "ddd, dd MMM yyyy hh:mm tt";
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return Binding.DoNothing;
        }
    }
}
